/*
From Wood & Hoy (2020) “Helping us or helping them? What makes foreign aid 
popular with donor publics?”, Economic Development and Cultural Change

Table 5 in main body of paper: Effect of treatments on beliefs about 
project motivation compared to basic treatment.
*/

//Create three binary variables. In these all treatment groups go to missing 
//except people in the treatment group of interest and the basic treatment group. 

//In first all respondents go to missing unless they are in basic treatment (0)
//or National interest treatment (1)
gen Self_Pl =.
replace Self_Pl = 0 if HQGROUP==1
replace Self_Pl = 1 if HQGROUP==3
label var Self_Pl "National interest"

//In first all respondents go to missing unless they are in basic treatment (0)
//or in help poor countries treatment (1)
gen Alt_Pl =.
replace Alt_Pl = 0 if HQGROUP==1
replace Alt_Pl = 1 if HQGROUP==2
label var Alt_Pl "Help others"

//In first all respondents go to missing unless they are in basic treatment (0)
//or in Global leader treatment (1)
gen Glob_Pl =.
replace Glob_Pl = 0 if HQGROUP==1
replace Glob_Pl = 1 if HQGROUP==4
label var Glob_Pl "Global leader"

//Loop through each of the possible response categories to the question about
//the purpose of the project. For each category chose the treatment "associated"
//with the category. i.e. for the think project's purpose is to make Australia
//a global leader, chose the global leader variable created above (Glob_Pl)
//for each a regression is run which captures the effect of the treatment in
//question on the belief that the project has the expected purpose given the 
//treatment. This regression is comparing the basic treatment with the treatment
//of interest. 

foreach dep in Q6_Ausint Q6_helppoor Q6_GloLead {
	if "`dep'" == "Q6_Ausint" { 
		local indep "Self_Pl"
		 }
	else if "`dep'" == "Q6_helppoor" {	
		 local indep "Alt_Pl"
		 }
	else if "`dep'" == "Q6_GloLead" { 
		 local indep "Glob_Pl"
		 }

	reg `dep' `indep'
	estimates store `indep'est , title("`: variable label `indep''")
}	

esttab Self_Plest Alt_Plest Glob_Plest using table_5.rtf, replace ///
mtitle label b(3) se(2) varwidth(15) ///
stats(F N, fmt(%8.2f %8.0fc) labels("F-statistic" "Observations")) ///
star(* 0.10 ** 0.05 *** 0.01) nobase nonumbers nogaps 

estimates clear

drop Self_Pl
drop Alt_Pl
drop Glob_Pl
